home *** CD-ROM | disk | FTP | other *** search
/ Web Star/List Star - Eve…he Ultimate Internet Site / StarNine Internet Pubisher (Web Star and List Star)(StarNine)(1995).iso / ListSTAR™ / Tools and Enhancments / Return Subscriber List / Return Address List v1.1 < prev   
Text File  |  1995-08-01  |  3KB  |  80 lines

  1. -----------------------------------------------------------------------
  2. -- StarNine Technologies, Inc., hereby disclaims all copyright interest
  3. -- in the following source code.
  4. -- 
  5. -- This source code is free and has been placed into the public domain.
  6. -- You can redistribute it, modify it (including these comments) and/or
  7. -- create derivative works from it as you see fit.
  8. --
  9. -- This source code is made available in the hope that it will be useful,
  10. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. -----------------------------------------------------------------------
  13.  
  14. set oldDelims to AppleScript's text item delimiters
  15. set AppleScript's text item delimiters to ":"
  16. set thePath to (text items 1 thru -2 of ((path to me) as string)) as string
  17. set AppleScript's text item delimiters to oldDelims
  18. set thePath to alias (thePath & ":ADMIN:Address Lists")
  19.  
  20. -- here you enter all of your services which will use this script and their file names
  21. -- the name can be found by choosing "Get Info" in the list editor of ListSTAR
  22. -- hopefully a future release will eliminate the need for this
  23.  
  24. if s9MailService is "Listserver Demo" then set theFile to "Listserver Demo List"
  25. if s9MailService is "My Own Service" then set theFile to "Listserver Demo List.0001"
  26.  
  27. --set the header of the body
  28. set theBody to "This is a list of subscribers to the " & s9MailService & " listserver." & return & return
  29.  
  30. --get the path to the address list
  31. set thePath to alias ((thePath as string) & theFile)
  32.  
  33. --open file for reading and read it into the variable listdata
  34. try
  35.     set listfile to open for access file (thePath as string) --open the file with the digest in it
  36.     set listdata to read listfile from 1 -- read the entire file into theBody
  37.     close access listfile --close the file
  38. on error errString number errNum
  39.     display dialog errString & " " & errNum
  40. end try
  41.  
  42. --first parse by line
  43. set oldDelims to AppleScript's text item delimiters
  44. set AppleScript's text item delimiters to return
  45.  
  46. --eliminate ListSTAR's header line
  47. set listdata to (text items 2 thru end of listdata)
  48.  
  49. --repeat with each line in the data file
  50. repeat with theline in listdata
  51.     set AppleScript's text item delimiters to tab --distinguish free form name from email address
  52.     if (text item 1 of theline is "") then
  53.         try
  54.             set theBody to theBody & text item 4 of theline & return --if no ffn, only show email    
  55.         on error
  56.             exit repeat
  57.         end try
  58.     else if (the first text item of theline is equal to text item 4 of theline) then --compare ffn to email
  59.         set theBody to theBody & the first text item of theline & return --if equal, only show once
  60.     else --otherwise add ffn, then tabs, then email
  61.         set theBody to theBody & (the first text item of theline)
  62.         repeat (35 - (count of characters in the first text item in theline)) times
  63.             set theBody to theBody & " "
  64.         end repeat
  65.         set theBody to theBody & (text item 4 of theline) & return
  66.     end if
  67.     set AppleScript's text item delimiters to return
  68. end repeat
  69. set AppleScript's text item delimiters to oldDelims
  70.  
  71. --return address list
  72. tell application "ListSTAR Server"
  73.     StarNine Log "sending subscriber list" Log Level Debug
  74.     StarNine Send s9MailService ¬
  75.         To {FreeFormName:s9SenderName, EMailAddress:s9SenderEmailAddress} as StarNineAddress ¬
  76.         Subject "Subscribers of the " & s9MailService & ¬
  77.         " list" Body theBody
  78. end tell
  79.  
  80. return 0